<div class="form">

<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'patients-form',
	'enableAjaxValidation'=>false,
)); ?>

	<p class="note">Fields with <span class="required">*</span> are required.</p>

	<?php echo $form->errorSummary($model); ?>
	<?php echo $form->errorSummary($modelAddress); ?>
	<fieldset>
	    <legend>Patient Information</legend>
		<div class="column">
			<?php echo $form->labelEx($model,'frstName'); ?>
			<?php echo $form->textField($model,'frstName',array('size'=>40,'maxlength'=>75)); ?>
			<?php echo $form->error($model,'frstName'); ?>
		</div>
	
		<div class="column">
			<?php echo $form->labelEx($model,'middleInitial'); ?>
			<?php echo $form->textField($model,'middleInitial',array('size'=>10,'maxlength'=>10)); ?>
			<?php echo $form->error($model,'middleInitial'); ?>
		</div>
	
		<div class="column">
			<?php echo $form->labelEx($model,'lastName'); ?>
			<?php echo $form->textField($model,'lastName',array('size'=>40,'maxlength'=>100)); ?>
			<?php echo $form->error($model,'lastName'); ?>
		</div>	
	<div class="column">
		<?php echo $form->labelEx($model,'dateOfBirth'); ?>
		<?php 
			$this->widget('zii.widgets.jui.CJuiDatePicker', array(
				'model'=>$model,
				'attribute'=>'dateOfBirth',
				'value'=>$model->dateOfBirth,
				'options'=>array(
				'dateFormat'=>'yy-mm-dd',
				'showAnim'=> 'fold',
				'autoSize'=>true,
				'showButtonPanel'=>true,
				'defaultDate'=>$model->dateOfBirth,
				),
			'htmlOptions'=>array(
			'style'=>'width:100px;'
			),
		));
		
		/*$this->widget('zii.widgets.jui.CJuiDatePicker', array(
   			 'name'=>'datepicker_field', // Name of the datepicker form field.
		    // additional javascript options for the date picker plugin
    		'options'=>array(
        		'showAnim'=>'fold',
        		'altField'=>'#dobselector', // The jQuery selector of the "target" field
        		'altFormat'=>'yy-mm-dd', // If you want the target field to have a different format
    		),
    		'htmlOptions'=>array(
        		'style'=>'height:20px;width:100px;',
    		),
		));*/
		
		/*$this->widget('zii.widgets.jui.CJuiDatePicker', array(
   		 'name'=>'Patients[dateOfBirth]',
		 'model'=>$model,
         'options'=>array(
      		   'showAnim'=>'fold',
			   'dateFormat'=>'d.M yy',
               'value'=>date('j.M Y'),
    			),
    	'htmlOptions'=>array(
        	'style'=>'height:20px;width:100px;'
    		),
		));*/
		?>
		<?php echo $form->error($model,'dateOfBirth'); ?>
	</div>
	<div class="column">
		<?php echo $form->labelEx($model,'gender'); ?>
		<?php echo $form->dropDownList($model, 'gender',  
              array('1' => 'Male', '2' => 'Female'),
              array('empty' => 'Select a Gender')); ?>	
   		<?php echo $form->error($model,'gender'); ?>
	</div>

	<div class="column">
		<?php echo $form->labelEx($model,'height'); ?>
		<?php echo $form->textField($model,'height', array('size'=>10)); ?>
		<?php echo $form->error($model,'height'); ?>
	</div>

	<div class="column">
		<?php echo $form->labelEx($model,'weight'); ?>
		<?php echo $form->textField($model,'weight', array('size'=>10)); ?>
		<?php echo $form->error($model,'weight'); ?>
	</div>
	<br><br>

	<div class="column">
		<?php echo $form->labelEx($model,'outpatient'); ?>
		<?php echo $form->checkBox($model,'outpatient'); ?>
		<?php echo $form->error($model,'outpatient'); ?>
	</div>	
	</fieldset>

	<fieldset>
	<legend>Address Information</legend>
	<div class="column">
		<?php echo $form->labelEx($modelAddress,'houseNumber'); ?>
		<?php echo $form->textField($modelAddress,'houseNumber',array('size'=>10,'maxlength'=>10)); ?>
		<?php echo $form->error($modelAddress,'houseNumber'); ?>
	</div>

	<div class="column">
		<?php echo $form->labelEx($modelAddress,'streetName'); ?>
		<?php echo $form->textField($modelAddress,'streetName',array('size'=>60,'maxlength'=>100)); ?>
		<?php echo $form->error($modelAddress,'streetName'); ?>
	</div>

	<div class="column">
		<?php echo $form->labelEx($modelAddress,'addressLine1'); ?>
		<?php echo $form->textField($modelAddress,'addressLine1',array('size'=>40,'maxlength'=>100)); ?>
		<?php echo $form->error($modelAddress,'addressLine1'); ?>
	</div>

	<div class="column">
		<?php echo $form->labelEx($modelAddress,'locality'); ?>
		<?php echo $form->textField($modelAddress,'locality',array('size'=>40,'maxlength'=>100)); ?>
		<?php echo $form->error($modelAddress,'locality'); ?>
	</div>
	
	<div class="column">
		<?php echo $form->labelEx($modelAddress,'country'); ?>
		<?php echo $form->dropDownList($modelAddress, 'country', 
		array(
			  "GB" => "United Kingdom",
			  "US" => "United States",
			  "AF" => "Afghanistan",
			  "AL" => "Albania",
			  "DZ" => "Algeria",
			  "AS" => "American Samoa",
			  "AD" => "Andorra",
			  "AO" => "Angola",
			  "AI" => "Anguilla",
			  "AQ" => "Antarctica",
			  "AG" => "Antigua And Barbuda",
			  "AR" => "Argentina",
			  "AM" => "Armenia",
			  "AW" => "Aruba",
			  "AU" => "Australia",
			  "AT" => "Austria",
			  "AZ" => "Azerbaijan",
			  "BS" => "Bahamas",
			  "BH" => "Bahrain",
			  "BD" => "Bangladesh",
			  "BB" => "Barbados",
			  "BY" => "Belarus",
			  "BE" => "Belgium",
			  "BZ" => "Belize",
			  "BJ" => "Benin",
			  "BM" => "Bermuda",
			  "BT" => "Bhutan",
			  "BO" => "Bolivia",
			  "BA" => "Bosnia And Herzegowina",
			  "BW" => "Botswana",
			  "BV" => "Bouvet Island",
			  "BR" => "Brazil",
			  "IO" => "British Indian Ocean Territory",
			  "BN" => "Brunei Darussalam",
			  "BG" => "Bulgaria",
			  "BF" => "Burkina Faso",
			  "BI" => "Burundi",
			  "KH" => "Cambodia",
			  "CM" => "Cameroon",
			  "CA" => "Canada",
			  "CV" => "Cape Verde",
			  "KY" => "Cayman Islands",
			  "CF" => "Central African Republic",
			  "TD" => "Chad",
			  "CL" => "Chile",
			  "CN" => "China",
			  "CX" => "Christmas Island",
			  "CC" => "Cocos (Keeling) Islands",
			  "CO" => "Colombia",
			  "KM" => "Comoros",
			  "CG" => "Congo",
			  "CD" => "Congo, The Democratic Republic Of The",
			  "CK" => "Cook Islands",
			  "CR" => "Costa Rica",
			  "CI" => "Cote D'Ivoire",
			  "HR" => "Croatia (Local Name: Hrvatska)",
			  "CU" => "Cuba",
			  "CY" => "Cyprus",
			  "CZ" => "Czech Republic",
			  "DK" => "Denmark",
			  "DJ" => "Djibouti",
			  "DM" => "Dominica",
			  "DO" => "Dominican Republic",
			  "TP" => "East Timor",
			  "EC" => "Ecuador",
			  "EG" => "Egypt",
			  "SV" => "El Salvador",
			  "GQ" => "Equatorial Guinea",
			  "ER" => "Eritrea",
			  "EE" => "Estonia",
			  "ET" => "Ethiopia",
			  "FK" => "Falkland Islands (Malvinas)",
			  "FO" => "Faroe Islands",
			  "FJ" => "Fiji",
			  "FI" => "Finland",
			  "FR" => "France",
			  "FX" => "France, Metropolitan",
			  "GF" => "French Guiana",
			  "PF" => "French Polynesia",
			  "TF" => "French Southern Territories",
			  "GA" => "Gabon",
			  "GM" => "Gambia",
			  "GE" => "Georgia",
			  "DE" => "Germany",
			  "GH" => "Ghana",
			  "GI" => "Gibraltar",
			  "GR" => "Greece",
			  "GL" => "Greenland",
			  "GD" => "Grenada",
			  "GP" => "Guadeloupe",
			  "GU" => "Guam",
			  "GT" => "Guatemala",
			  "GN" => "Guinea",
			  "GW" => "Guinea-Bissau",
			  "GY" => "Guyana",
			  "HT" => "Haiti",
			  "HM" => "Heard And Mc Donald Islands",
			  "VA" => "Holy See (Vatican City State)",
			  "HN" => "Honduras",
			  "HK" => "Hong Kong",
			  "HU" => "Hungary",
			  "IS" => "Iceland",
			  "IN" => "India",
			  "ID" => "Indonesia",
			  "IR" => "Iran (Islamic Republic Of)",
			  "IQ" => "Iraq",
			  "IE" => "Ireland",
			  "IL" => "Israel",
			  "IT" => "Italy",
			  "JM" => "Jamaica",
			  "JP" => "Japan",
			  "JO" => "Jordan",
			  "KZ" => "Kazakhstan",
			  "KE" => "Kenya",
			  "KI" => "Kiribati",
			  "KP" => "Korea, Democratic People's Republic Of",
			  "KR" => "Korea, Republic Of",
			  "KW" => "Kuwait",
			  "KG" => "Kyrgyzstan",
			  "LA" => "Lao People's Democratic Republic",
			  "LV" => "Latvia",
			  "LB" => "Lebanon",
			  "LS" => "Lesotho",
			  "LR" => "Liberia",
			  "LY" => "Libyan Arab Jamahiriya",
			  "LI" => "Liechtenstein",
			  "LT" => "Lithuania",
			  "LU" => "Luxembourg",
			  "MO" => "Macau",
			  "MK" => "Macedonia, Former Yugoslav Republic Of",
			  "MG" => "Madagascar",
			  "MW" => "Malawi",
			  "MY" => "Malaysia",
			  "MV" => "Maldives",
			  "ML" => "Mali",
			  "MT" => "Malta",
			  "MH" => "Marshall Islands",
			  "MQ" => "Martinique",
			  "MR" => "Mauritania",
			  "MU" => "Mauritius",
			  "YT" => "Mayotte",
			  "MX" => "Mexico",
			  "FM" => "Micronesia, Federated States Of",
			  "MD" => "Moldova, Republic Of",
			  "MC" => "Monaco",
			  "MN" => "Mongolia",
			  "MS" => "Montserrat",
			  "MA" => "Morocco",
			  "MZ" => "Mozambique",
			  "MM" => "Myanmar",
			  "NA" => "Namibia",
			  "NR" => "Nauru",
			  "NP" => "Nepal",
			  "NL" => "Netherlands",
			  "AN" => "Netherlands Antilles",
			  "NC" => "New Caledonia",
			  "NZ" => "New Zealand",
			  "NI" => "Nicaragua",
			  "NE" => "Niger",
			  "NG" => "Nigeria",
			  "NU" => "Niue",
			  "NF" => "Norfolk Island",
			  "MP" => "Northern Mariana Islands",
			  "NO" => "Norway",
			  "OM" => "Oman",
			  "PK" => "Pakistan",
			  "PW" => "Palau",
			  "PA" => "Panama",
			  "PG" => "Papua New Guinea",
			  "PY" => "Paraguay",
			  "PE" => "Peru",
			  "PH" => "Philippines",
			  "PN" => "Pitcairn",
			  "PL" => "Poland",
			  "PT" => "Portugal",
			  "PR" => "Puerto Rico",
			  "QA" => "Qatar",
			  "RE" => "Reunion",
			  "RO" => "Romania",
			  "RU" => "Russian Federation",
			  "RW" => "Rwanda",
			  "KN" => "Saint Kitts And Nevis",
			  "LC" => "Saint Lucia",
			  "VC" => "Saint Vincent And The Grenadines",
			  "WS" => "Samoa",
			  "SM" => "San Marino",
			  "ST" => "Sao Tome And Principe",
			  "SA" => "Saudi Arabia",
			  "SN" => "Senegal",
			  "SC" => "Seychelles",
			  "SL" => "Sierra Leone",
			  "SG" => "Singapore",
			  "SK" => "Slovakia (Slovak Republic)",
			  "SI" => "Slovenia",
			  "SB" => "Solomon Islands",
			  "SO" => "Somalia",
			  "ZA" => "South Africa",
			  "GS" => "South Georgia, South Sandwich Islands",
			  "ES" => "Spain",
			  "LK" => "Sri Lanka",
			  "SH" => "St. Helena",
			  "PM" => "St. Pierre And Miquelon",
			  "SD" => "Sudan",
			  "SR" => "Suriname",
			  "SJ" => "Svalbard And Jan Mayen Islands",
			  "SZ" => "Swaziland",
			  "SE" => "Sweden",
			  "CH" => "Switzerland",
			  "SY" => "Syrian Arab Republic",
			  "TW" => "Taiwan",
			  "TJ" => "Tajikistan",
			  "TZ" => "Tanzania, United Republic Of",
			  "TH" => "Thailand",
			  "TG" => "Togo",
			  "TK" => "Tokelau",
			  "TO" => "Tonga",
			  "TT" => "Trinidad And Tobago",
			  "TN" => "Tunisia",
			  "TR" => "Turkey",
			  "TM" => "Turkmenistan",
			  "TC" => "Turks And Caicos Islands",
			  "TV" => "Tuvalu",
			  "UG" => "Uganda",
			  "UA" => "Ukraine",
			  "AE" => "United Arab Emirates",
			  "UM" => "United States Minor Outlying Islands",
			  "UY" => "Uruguay",
			  "UZ" => "Uzbekistan",
			  "VU" => "Vanuatu",
			  "VE" => "Venezuela",
			  "VN" => "Viet Nam",
			  "VG" => "Virgin Islands (British)",
			  "VI" => "Virgin Islands (U.S.)",
			  "WF" => "Wallis And Futuna Islands",
			  "EH" => "Western Sahara",
			  "YE" => "Yemen",
			  "YU" => "Yugoslavia",
			  "ZM" => "Zambia",
			  "ZW" => "Zimbabwe"),
              array('empty' => 'Select a Country')); ?>	
  		<?php echo $form->error($modelAddress,'country'); ?>
	</div>	
	<div class="column">
		<?php echo $form->labelEx($modelAddress,'postCode'); ?>
		<?php echo $form->textField($modelAddress,'postCode',array('size'=>6,'maxlength'=>6)); ?>
		<?php echo $form->error($modelAddress,'postCode'); ?>	
	</div>
	<div class="column">
		<?php echo $form->labelEx($modelAddress,'city'); ?>
		<?php echo $form->textField($modelAddress,'city',array('size'=>30,'maxlength'=>100)); ?>
		<?php echo $form->error($modelAddress,'city'); ?>
	</div>
	</fieldset>
	<fieldset>
	<legend>Contact Information</legend>
	
		<div class="column">
		<?php echo $form->labelEx($model,'emergencyContactName'); ?>
		<?php echo $form->textField($model,'emergencyContactName',array('size'=>40,'maxlength'=>125)); ?>
		<?php echo $form->error($model,'emergencyContactName'); ?>
	</div>

	<div class="column">
		<?php echo $form->labelEx($model,'emergencyContactNumber'); ?>
		<?php echo $form->textField($model,'emergencyContactNumber',array('size'=>25,'maxlength'=>15)); ?>
		<?php echo $form->error($model,'emergencyContactNumber'); ?>
	</div>

	<div class="column">
		<?php echo $form->labelEx($model,'homePhone'); ?>
		<?php echo $form->textField($model,'homePhone',array('size'=>25,'maxlength'=>15)); ?>
		<?php echo $form->error($model,'homePhone'); ?>
	</div>

	<div class="column">
		<?php echo $form->labelEx($model,'cellPhone'); ?>
		<?php echo $form->textField($model,'cellPhone',array('size'=>25,'maxlength'=>15)); ?>
		<?php echo $form->error($model,'cellPhone'); ?>
	</div>
	
	<div class="column">
		<?php echo $form->labelEx($model,'emailAddress'); ?>
		<?php echo $form->textField($model,'emailAddress',array('size'=>60,'maxlength'=>75)); ?>
		<?php echo $form->error($model,'emailAddress'); ?>
	</div>	
	
	</fieldset>

	<fieldset>
	<legend>Misc Information</legend>
	
	<div class="column">
		<?php echo $form->labelEx($model,'hospitalId'); ?>
		<?php echo $form->dropDownList($model, 'hospitalId', CHtml::listData(
				Hospital::model()->findAll(), 'hospitalId', 'title'),
				array('prompt' => 'Select a Hospital')
		); ?>
		<?php echo $form->error($model,'hospitalId'); ?>
	</div>
	


	<div class="column">
		<?php echo $form->labelEx($model,'insuranceName'); ?>
		<?php echo $form->textField($model,'insuranceName',array('size'=>30,'maxlength'=>100)); ?>
		<?php echo $form->error($model,'insuranceName'); ?>
	</div>

	<div class="column">
		<?php echo $form->labelEx($model,'insuranceCardNumber'); ?>
		<?php echo $form->textField($model,'insuranceCardNumber',array('size'=>25,'maxlength'=>25)); ?>
		<?php echo $form->error($model,'insuranceCardNumber'); ?>
	</div>
	
	<div class="column">
		<?php echo $form->labelEx($model,'comments'); ?>
		<?php echo $form->textArea($model,'comments',array('size'=>60,'maxlength'=>255)); ?>
		<?php echo $form->error($model,'comments'); ?>
	</div>
	
	</fieldset>


	<div class="rowhidden">
		<?php echo $form->labelEx($model,'createdBy'); ?>
		<?php echo $form->textField($model,'createdBy',array('size'=>10,'maxlength'=>10)); ?>
		<?php echo $form->error($model,'createdBy'); ?>
	</div>

	<div class="rowhidden">
		<?php echo $form->labelEx($model,'createdTime'); ?>
		<?php echo $form->textField($model,'createdTime'); ?>
		<?php echo $form->error($model,'createdTime'); ?>
	</div>

	<div class="rowhidden">
		<?php echo $form->labelEx($model,'updatedBy'); ?>
		<?php echo $form->textField($model,'updatedBy',array('size'=>10,'maxlength'=>10)); ?>
		<?php echo $form->error($model,'updatedBy'); ?>
	</div>

	<div class="rowhidden">
		<?php echo $form->labelEx($model,'updatedTime'); ?>
		<?php echo $form->textField($model,'updatedTime'); ?>
		<?php echo $form->error($model,'updatedTime'); ?>
	</div>

	<div class="buttons">
		<?php echo CHtml::submitButton($model->isNewRecord ? 'Create Patient' : 'Save Patient'); ?>
	</div>

<?php $this->endWidget(); ?>

</div><!-- form -->